-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Graph list patch #4113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graph list patch #4113
Conversation
Please look at the failing test... |
I have made the edit, but I'm currently facing new issues. |
graphs/graph_list.py
Outdated
# with destination vertex as key, which has no adjacent vertex | ||
else: | ||
self.adj_list[source_vertex] = [destination_vertex] | ||
self.adj_list[destination_vertex] = [] | ||
|
||
def print_list(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this __str__()
instead and then print(graph)
and print(repr(graph))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need doctests for both.
graphs/graph_list.py
Outdated
def print_list(self) -> None: | ||
return self | ||
|
||
def __str__(self) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK... If __str__()
and __repr__()
are going to return the same values then we can delete __str__()
but leave the tests unmodulated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably too many comments but let's land it.
* new implementation for adjacency list graph * add example code for undirected graph * reduce length to 88 columns max to fix build errors7 * fix pre commit issues * replace print_list method with __str__ * return object in add_edge method to enable fluent syntax * improve class docstring and include doctests * add end of file line * fix pre-commit issues * remove __str__ method * trigger build * Update graph_list.py * Update graph_list.py Co-authored-by: gnc <[email protected]> Co-authored-by: Christian Clauss <[email protected]>
* new implementation for adjacency list graph * add example code for undirected graph * reduce length to 88 columns max to fix build errors7 * fix pre commit issues * replace print_list method with __str__ * return object in add_edge method to enable fluent syntax * improve class docstring and include doctests * add end of file line * fix pre-commit issues * remove __str__ method * trigger build * Update graph_list.py * Update graph_list.py Co-authored-by: gnc <[email protected]> Co-authored-by: Christian Clauss <[email protected]>
* new implementation for adjacency list graph * add example code for undirected graph * reduce length to 88 columns max to fix build errors7 * fix pre commit issues * replace print_list method with __str__ * return object in add_edge method to enable fluent syntax * improve class docstring and include doctests * add end of file line * fix pre-commit issues * remove __str__ method * trigger build * Update graph_list.py * Update graph_list.py Co-authored-by: gnc <[email protected]> Co-authored-by: Christian Clauss <[email protected]>
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.